cmake_minimum_required(VERSION 3.10.0)
project(SDLShooter VERSION 0.1.0 LANGUAGES C CXX)

#设置C++标准
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

#设置编译警告级别
if (MSVC)
    add_compile_options(/W4)
else()
    add_compile_options(-Wall -Wextra -Werror)
endif()

#设置编译输出目录
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR})
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR})

set(TARGET ${PROJECT_NAME}-${CMAKE_SYSTEM_NAME})

#查找并载入cmake预设
find_package(SDL2 REQUIRED)
find_package(SDL2_image REQUIRED)
find_package(SDL2_mixer REQUIRED)
find_package(SDL2_ttf REQUIRED)

#添加可执行文件
add_executable(${TARGET} "src/main.cpp"
                            "src/manager/gameMer.cpp"
                            "src/entity/scene.cpp"
                            "src/entity/sceneMain.cpp"
                            "src/entity/sceneTitle.cpp"
                            "src/entity/sceneEnd.cpp")

#链接库
target_link_libraries(${TARGET} 
                            ${SDL2_LIBRARIES}
                            SDL2_image::SDL2_image
                            SDL2_mixer::SDL2_mixer
                            SDL2_ttf::SDL2_ttf)
